Many techniques for supporting network processing are known. Such techniques include generic memory management, interrupt scheduling, state machines, computer program code generation, and multi-protocol interfaces. The foundations of such techniques are generally understood but in many cases their practical realization has fallen short of their potential.
Memory management is an important aspect of computer systems and multiprocessor computer systems, and typically includes a process of coordinating and/or controlling the allocation and deallocation of memory. Memory management is generally described as including memory hardware and a memory manager, and is used by any of a variety of applications. The memory hardware may include electronic devices and associated circuitry capable of storing information, such as, RAM (random access memory), MMUs (memory management units), caches, disks, processor registers, and similar storage devices. A variety of applications require memory to function properly.
The applications may request memory allocation, use the memory, and then deallocate the requested memory. Each request is processed by the memory manager coupled to a large pool of memory. The memory manager manages the allocation and deallocation of memory, and processes the application request for allocation and/or deallocation of memory. Unfortunately, applications cannot generally predict in advance how much memory will be required, and the requirement for memory may dynamically change as the application executes.
The memory manager combines two related tasks of allocation and deallocating. Allocation is performed when an application requests a block of memory. The memory manager determines which block memory to allocate based on a list of available blocks. Deallocating memory is performed when a memory block has been allocated and the application indicates the block is no longer required. Alternatively the memory manager or another computer program may determine the allocated memory is no longer required by the application. The memory manager may add the deallocated block of memory back to the pool of available memory making the block of memory available for other allocation requests.
Memory management is a complex task of managing memory so that the application can run efficiently. The design of memory management system is important to the performance of modern computer systems. In fact, memory can be a primary factor of system performance. The memory manager is typically independent from the applications making allocation and deallocation requests and therefore processes individual requests from a number of applications. Consequently the memory manager must perform an analysis including the allocation of available memory based on individual memory allocation and deallocation requests. Each allocation and subsequent deallocation must then be tracked to ensure the integrity of the memory. Typically, the process of allocating and deallocating memory over time generates memory fragmentation which further complicates the memory management process and degrades the memory managers performance. Memory fragmentation can results in the allocation of non-contiguous memory blocks. Consequently, the performance of current memory managers are unpredictable and are therefore very difficult to use in a multiprocessor system or environment.
In one scenario, an application may make a request for an allocation of memory. The memory manager receives the request, allocates the requested memory, and provides the location of the allocated memory to the requesting application. The application then initializes the memory for use by the application. The initialization may include writing a string of zeros into the allocated memory and/or use some other time consuming initialization process to setup the allocated memory. The application then uses the allocated memory. When the application is finished using the allocated memory, the application may make a request to deallocate the memory previously allocated. The memory manager receives the request and deallocates the corresponding memory. The application may then make a second request for an allocation of memory, and so on, following a similar process. Unfortunately, the application can not make any assumptions concerning the allocated memory and must typically reinitialize any allocated memory. Consequently, any previous initialization that may have been performed in conjunction with the same memory location is repeated. Unfortunately, memory managers lack support for minimizing unnecessary initialization of allocated memory, such as for example, re-initialization of a memory location that was previously initialized and deallocated.
There are generally two approaches to recycling memory: either the computer programmer must decide when memory may be reused (known as manual memory management); or the memory manager must decide (known as automatic memory management). Manual memory management requires the application computer programmer to control when and how memory is recycled. Usually this is either by explicit calls to memory management functions, such as a so-called malloc command (allocate) and a so-called free command (deallocate) in the C computer programming language. The key feature of a manual memory manager is that memory is not recycled without instructions from the application to recycle the memory. One advantage of this approach is that is typically easier for the application computer programmer to understand how memory is allocated and recycled. Unfortunately the application computer programmer is required to write a considerable amount of computer program code or computer program instructions to manage the memory used by the application. Further the computer program instructions written for managing the memory typically require verification and debugging. Some computer programming languages primarily use this type of manual memory management, such as for example C, C++, Assembly, Fortran, and Pascal. Unfortunately, this approach increases the complexity of computer programming by an order of magnitude and detracts from the computer programmers focus on the objectives of the application.
Automatic memory management is an alternative approach that may be provided as part of a computer programming language and/or computer programming language extension for automatically recycling memory that an application computer program would not otherwise use again. Automatic memory managers, such as a so-called garbage collector, usually recycle memory blocks that are unreachable by the application computer program. For example a pointer to an allocated memory block may be provided to an application. If the application deletes the pointer then the memory management function can determine the memory block is no longer accessible to the application and therefore may be added to pool of available memory. Advantageously, the application computer programmer can focus on the actual computer program rather than focusing on managing memory. Unfortunately, keeping track of accessible memory blocks typically requires a considerable amount of computational overhead. Some computer programming languages use automatic memory management, such as for example, Java™, JavaScript™, Lisp, and other languages as are known in the art and their equivalents.
Unfortunately, both the manual and automatic approaches to memory management suffer from potential memory fragmentation, unpredictable allocation and deallocation performance, and a lack of support for minimizing the re-initialization of memory.
Therefore conventional memory managers are not efficient and there remains a need for a system, method, computer program, and computer program product for memory management that reduces potential memory fragmentation, performs allocation and deallocation according to a predictable performance, and provides support for minimizing the re-initialization of memory. What is needed is an ability to provide memory management that overcomes the above and other disadvantages of known network processors.